#pragma once

#include "Level1.h"
#include "Level2.h"
#include "Level3.h"
#include "Level4.h"

#include "Character.h"
#include "GameMenu.h"

#include "Sound.h"

#include "Achievement.h"
#include "Inventory.h"

#include "Mouse.h"

/**
	* Class for Level Switcher
	*
	* Handles which level to initialize, render and update
	* Has the original player to pass into the level. No need for multiple creation of player on each level
*/
class LevelSwitcher{
private:
	int currentLevel;

	Character *player;

	Level *level;

	bool init, startGame;
	
	CGameMenu * theGameMenu;

	Sound *theSound;

	MouseInfo *mouseInfo;
public:
	CWeapon::WEAPON player_weapon_track;

	LevelSwitcher(void);
	~LevelSwitcher(void);

	// inventory
	Inventory*		GetInventory		(void) { return this->player->GetInventory(); }

	// player
	Character*		GetPlayer			(void) { return this->player; }
	void			CreateNewPlayer		(CWeapon::WEAPON player_weapon_track);
	bool			SavePlayer			(void);
	bool			LoadPlayer			(void);

	// weapon
	bool			WeaponLevel			(const CWeapon::WEAPON weapon, const int amount);
	bool			WeaponUnlock		(const CWeapon::WEAPON weapon, const bool unlock = true);
	bool			WeaponSelect		(const CWeapon::WEAPON weapon);
	
	int				CheckWeaponLevel	(const CWeapon::WEAPON weapon) { return ( player ) ? this->player->Check_Weapon_Level( weapon )			: -1;	}
	bool			CheckWeaponUnlock	(const CWeapon::WEAPON weapon) { return ( player ) ? this->player->Check_Weapon_Unlock_Status( weapon )	: false;	}
	CWeapon::WEAPON CheckWeaponSelect	(const CWeapon::WEAPON weapon) { return this->player_weapon_track; }
	
	void InitLevelSwitcher(MouseInfo *mouseInfo, CGameMenu* theGameMenu, Sound* theSound);
	/**
		* Function to switch between each level
		*
		* @param Take in a int value for which level to switch to
	*/
	void SwitchLevel(int whichLevel);
	
	/**
		* Function to initialize the level
	*/
	void InitLevel(void);

	/**
		* Function to end the level
	*/
	void EndLevel(void);

	/**
		* Function to render the level
	*/
	void RenderLevel(void);
	
	/**
		* Function to update the level
		*
		* @param Pass in key press for further check
		* @param Elapsed time for frame independent movement
	*/
	void UpdateLevel(bool *myKeys, float elapsed);

	/**
		*Function to return character position
		*Return only X or Y, with X being true
	*/
	Vector3D ReturnCharPos(void);
};